//
//  LiveTimeView.m
//  Bread-Live
//
//  Created by ios on 2017/3/14.
//  Copyright © 2017年 Chris. All rights reserved.
//


//NSDictionary *attrs = @{NSFontAttributeName : [UIFont boldSystemFontOfSize:17]};
//CGSize size=[_itemNamelabel.text sizeWithAttributes:attrs];
//[self.itemNamelabel setFrame:CGRectMake(40, 10, size.width, 20)];
//

#import "LiveTimeView.h"

@interface LiveTimeView ()
@property(nonatomic,strong) UIImageView *leftImageView;
@property(nonatomic,strong) UILabel     *titleLabel;

@end

@implementation LiveTimeView

//-(LiveTimeView *)initTimeTitle:(NSString *)title textFont:(UIFont *)font liveStatus:(BOOL)islived{
//    
//    
//   // LiveTimeView *timeView = [LiveTimeView alloc]
//    
//}


-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.layer.cornerRadius = 10;
        self.layer.borderWidth  = 0.6;
        
        [self configView];
    }
    return self;
}

-(void)setliveTimeTitle:(NSString *)text liveStatus:(BOOL)lived{
    
    if (!lived) {
        self.layer.borderColor = [UIColor blackColor].CGColor;
        _titleLabel.textColor  = [UIColor blackColor];
    }else{
        self.layer.borderColor = WYCOLOR(191, 190, 191, 1.0).CGColor;
        _titleLabel.textColor  = WYCOLOR(191, 190, 191, 1.0);
    }
    _titleLabel.text = text;
}

-(void)configView{
    
    _leftImageView = [[UIImageView alloc] init];
    _leftImageView.image = [UIImage imageFromColor:WYCOLOR(255, 237, 167, 1.0)];
    
    [self addSubview:_leftImageView];
    
    _titleLabel  = [[UILabel alloc] init];
    _titleLabel.font  = [UIFont wyNormalFot:13];
    
    [self addSubview:_titleLabel];
}


-(void)layoutSubviews{
    [super layoutSubviews];
    
    CGFloat viewW = self.frame.size.width;
    CGFloat viewH = self.frame.size.height;
    
    self.leftImageView.frame = CGRectMake(5, viewH/2-5, 10, 10);
    self.titleLabel.frame    = CGRectMake(20, 2, viewW-25, 21);
    
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
